﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Aij1.BLL;
using DevExpress.Xpo;
using Aij1.Utils;
using Aij1.Model;
using DevExpress.Web.ASPxEditors;

namespace Aij1.Cms
{
    /// <summary>
    /// 回复客户的留言页面
    /// </summary>
    public partial class ReplyGuest : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Page_Init(object sender, EventArgs e)
        {
            XpoDataSource1.Session = XpoSession;
        }

        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            string replyer = e.NewValues["Replyer"].ToString();
            if (String.IsNullOrEmpty(replyer))
            {
                e.NewValues["Replyer"] = CurrentUser.TrueName;
            }
            DateTime replyTime = (DateTime)e.NewValues["ReplyTime"];
            if (replyTime == default(DateTime))
            {
                e.NewValues["ReplyTime"] = DateTime.Now;
            }
        }
    }
}